import request from '@/utils/request'

// 网关前缀 + 控制器前缀
// patient(网关服务) + follow(控制器)
export const FOLLOW_PREFIX = '/patient/follow'

// 后端 FollowController 路径映射，便于复用/排查
export const FollowEndpoints = {
  list: `${FOLLOW_PREFIX}/list`, // GET
  follow: (doctorId) => `${FOLLOW_PREFIX}/follow/${doctorId}`, // PUT
  cancel: (doctorId) => `${FOLLOW_PREFIX}/cancelFollow/${doctorId}` // PUT
}

// 获取我的关注列表
export function listMyFollow() {
  return request({ url: FollowEndpoints.list, method: 'get' })
}

// 关注医生（PUT /follow/{doctorId}）
export function addFollow(doctorId) {
  return request({ url: FollowEndpoints.follow(doctorId), method: 'put' })
}

// 取消关注医生（PUT /cancelFollow/{doctorId}）
export function cancelFollow(doctorId) {
  return request({ url: FollowEndpoints.cancel(doctorId), method: 'put' })
}
